# 导包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

# 创建浏览器驱动对象，获取浏览器驱动
driver = webdriver.Firefox()
# 打开测试的网址
url = 'file:///C:/Users/TEACHER/Desktop/NSD2405/html/registerA.html'
driver.get(url)
# CSS定位
# username = driver.find_element(By.CSS_SELECTOR, '#userA')
# username = driver.find_element(By.CSS_SELECTOR, '#p1>input')
username = driver.find_element(By.CSS_SELECTOR, 'input[name="userA"]')
username.send_keys('admin')
# 通过CSS定位密码，电话，邮箱，并输入值
# 最后注册按钮，并点击
driver.find_element(By.CSS_SELECTOR, '[type="password"]').send_keys('123456')
driver.find_element(By.CSS_SELECTOR, '.telA').send_keys('18812345678')
driver.find_element(By.CSS_SELECTOR, '#emailA').send_keys('123@qq.com')
sleep(3)
driver.find_element(By.CSS_SELECTOR, 'button[value="注册A"]').click()


# 停顿3秒，关闭浏览器驱动
sleep(3)
driver.quit()